# Copyright (c) 2008, David Beck
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# rt0d4 / rt0d4_rx / test

IF(WIN32)
  LINK_LIBRARIES(
      rt0d4_rx
      rt0d4_sec
      rt0d4_common 
      ssleay32MT 
      libeay32MT 
      afsrx
      afslwp
      afsutil
      afsreg
      # afsrpc 
      zlib 
      wsock32)
  INCLUDE_DIRECTORIES(
      ../src
      ../../rt0d4_common/src 
      ../../rt0d4_sec/src 
      $ENV{OPENSSL_DEV_ENV}/include
      $ENV{ZLIB_DEV_ENV}/include
      $ENV{AFS_DEV_ENV}/include )
  LINK_DIRECTORIES(
      ../src
      ../../rt0d4_common/src
      ../../rt0d4_sec/src
      $ENV{OPENSSL_DEV_ENV}/lib/VC/static
      $ENV{ZLIB_DEV_ENV}/lib 
      $ENV{AFS_DEV_ENV}/lib 
      $ENV{AFS_DEV_ENV}/lib/afs )
ELSE(WIN32)
  ADD_DEFINITIONS(-Wall -O3)
  INCLUDE_DIRECTORIES(
      ../src
      ../../rt0d4_common/src
      ../../rt0d4_sec/src )
  LINK_LIBRARIES(
      rt0d4_rx
      rt0d4_sec
      rt0d4_common
      rx
      lwp
      afsrpc
      ssl
      crypto
      dl
      z
      stdc++)
  LINK_DIRECTORIES( ../src 
                    ../../rt0d4_common/src 
                    ../rt0d4_sec/src
                    /usr/local/ssl/lib )
ENDIF(WIN32)

ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/t__t1.h
                           ${CMAKE_CURRENT_SOURCE_DIR}/t__t1.ss.c
                           ${CMAKE_CURRENT_SOURCE_DIR}/t__t1.cs.c
                           ${CMAKE_CURRENT_SOURCE_DIR}/t__t1.xdr.c
                    PRE_BUILD
                    COMMAND rxgen ARGS t__t1.xg
                    MAIN_DEPENDENCY t__t1.xg
                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )

ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/t__demo1.h
                           ${CMAKE_CURRENT_SOURCE_DIR}/t__demo1.ss.c
                           ${CMAKE_CURRENT_SOURCE_DIR}/t__demo1.cs.c
                    PRE_BUILD
                    COMMAND rxgen ARGS t__demo1.xg
                    MAIN_DEPENDENCY t__demo1.xg
                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )

ADD_EXECUTABLE( t__t1_null_client
                t__t1_client.cc t__t1.cs.c t__t1.xdr.c t__sec_null.cc)

ADD_EXECUTABLE(t__t1_null_server
               t__t1_server.cc t__t1.ss.c t__t1.xdr.c t__sec_null.cc)

ADD_EXECUTABLE(t__t1_simple_client
               t__t1_client.cc t__t1.cs.c t__t1.xdr.c t__sec_simple.cc)

ADD_EXECUTABLE(t__t1_simple_server
               t__t1_server.cc t__t1.ss.c t__t1.xdr.c t__sec_simple.cc)

ADD_EXECUTABLE(t__t1_rt0d4_client
               t__t1_client.cc t__t1.cs.c t__t1.xdr.c t__sec_rt0d4.cc)

ADD_EXECUTABLE(t__t1_rt0d4_server
               t__t1_server.cc t__t1.ss.c t__t1.xdr.c t__sec_rt0d4.cc)

ADD_EXECUTABLE(t__demo1_client
               t__demo1_client.cc t__demo1.cs.c)

ADD_EXECUTABLE(t__demo1_server
               t__demo1_server.cc t__demo1.ss.c)

ADD_EXECUTABLE(t__demo1_cb_client
               t__demo1_cb_client.cc t__demo1.cs.c)

ADD_EXECUTABLE(t__demo1_cb_server
               t__demo1_cb_server.cc t__demo1.ss.c)

ADD_EXECUTABLE(t__roundup t__roundup.cc)

ADD_EXECUTABLE(t__xdr t__xdr.cc t__t1.xdr.c)

# -- EOF --
